#ifndef LightingManager_H
#define LightingManager_H

#include "Singleton.h"
#include "Light.h"

#include <string>
#include <vector>
#include <D3DX11.h>
#include <D3DX10math.h>
#include <map>

typedef std::map<int, Light> LightMap;

class LightingManager : public Uncopyable
{
	LightingManager();
	friend class Singleton<LightingManager>;
public:
	void SetLight(int lightNum, const Light& light);
	const Light& GetLight(int lightNum);
	int GetNumberOfLights() {return m_numOfLights;}

	void Draw(int lightNum);
	void DrawAll();

	void DisableLighting();
	void EnableLighting();
	void Disable(int lightNum);
	void Enable(int lightNum);

	void SetLightViewMatrix(const D3DXMATRIX& m);
	const D3DXMATRIX& GetLightViewMatrix() const;
	void SetLightProjMatrix(const D3DXMATRIX& m);
	const D3DXMATRIX& GetLightProjMatrix() const;
	void SetLightMatrices(const D3DXMATRIX& view, const D3DXMATRIX& proj);

private:
	const void CheckLight(int lightNum);

private:
	LightMap m_lights;
	bool m_enabled;

	int m_numOfLights;

	D3DXMATRIX m_viewMatrix;
	D3DXMATRIX m_projMatrix;

	bool m_drawLights;
};

typedef Singleton<LightingManager> TheLightingManager;

#endif //LightingManager_H